<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 500px;
        height: 300px;
        margin: 0 auto;
        background-color: black;
        cursor: pointer;
      }
    </style>
  </head>
  <body>
    <div class="box">...</div>
    <script>
      document.getElementsByClassName("box")[0].onclick = function () {
        alert("这是一个寂寞的天，下着有些伤心的雨");
      };
    </script>
  </body>
</html>
